<template>
  <div class="jibing-chaxun">
    <!-- <div class="d-f">
        <input placeholder="请输入想要查询的药理" v-model="inputvalue" autofocus="autofocus">
        <div class="sousuo" @click="getsearch">搜索</div>
    </div> -->
    <div class="input">
      <input placeholder="请输入想要查询的药理"  v-model="inputvalue">
      <span class="sousuo" @click="getsearch">搜索</span>
    </div>
    <div v-show='list!="1"'>
      <div class="box" v-show='list !== undefined || list.length != 0'>
        <div class="item" v-for="(item,index) in list" :key="index"  @click="godetails(item.id,item.name)">
          <div class="xinxi">
            <p class="p1">{{item.name}}</p>
            <p class="p2">{{item.ingredient}}</p>
          </div>
        </div>
      </div>
      <div class="nr" v-show='list == undefined || list.length ==0'>
        <div style="margin-top:50px;font-size:16px;text-align:center;">暂无内容</div>
      </div>
    </div>
    <div v-show='list=="1"'>
      <div class="nr" >
        <!-- <div>暂无内容</div> -->
      </div>
    </div>
    
  </div>
</template>

<script>
  export default {
    name:'jibing-search',
    data() {
      return {
        inputvalue:'',
        list:'1'
      }
    },
    created() {
      
    },
    mounted(){
      
    },
    methods: {
      // 搜索
      getsearch(){
        this.$get("api/gzh_index.php?action=yaoli_goods_list", {
          name:this.inputvalue
        }).then(res => { 
            console.log(res.data,'res.data')
            this.list=res.data
        }).catch(err => {
        
        }); 
      },
      // // 去详情
      // godetails(id){
      //   this.$router.push({
      //     name:'pathology-query-details',
      //     query: {id:id}
      //   }) 
      // },
      // 跳转药品详情
      godetails(id,title){
        this.$router.push({name:'pathology-query-details',query: {id:id,title:title}}) 
      }

    },
   
  }
</script>

<style scoped>


/* .d-f{
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-top: 20px;
}
.jibing-chaxun{
  width: 100%;
  height:100%;
}

input{
  width: 80%;
  height: 73px;
  outline: none;
  border: 1PX solid #F2F2F2;
  border-radius: 15px;
  padding: 0 20px;
  box-sizing: border-box;
  font-size:26px;
  line-height: 26px;
  font-family:PingFang SC;
  font-weight:500;
}
.sousuo{
  width:10%;
  height:50px;
  font-size: 26px;
  line-height: 50px;
  background-color: #db4949;
  border-radius: 10px;
  color: #fff;
  text-align: center;
} */

.input {
  width: 100%;
  height: 140px;
  padding: 0 30px;
  box-sizing: border-box;
  position: relative;
  background: #db4949;
}
.input input{
  width: 590px;
  height: 73px;
  border-radius: 10px;
  outline:none;
  padding: 0 10px;
  border: none;
  background: #fff;
  box-sizing: border-box;
  margin-top: 30px;
  font-size:26px;
  font-family:PingFang SC;
  font-weight:500;
  
}
.sousuo{
  font-size: 28px;
  color: #fff;
  margin-left: 15px;
} 











.box{
  width:691px;
  margin: auto;
}
.item{
  width: 100%;
  border-bottom: 1PX solid #EBEBEB;
  display: flex;
  align-items: center;
  padding: 30px 0;
}
.item .xinxi{
  width: 100%;
}
.p1{
  font-size:30px;
  font-family:PingFang SC;
  font-weight:bold;
  color:rgba(0,0,0,1);
  line-height:40px;
}
.p2{
  font-size:26px;
  font-family:PingFang SC;
  font-weight:500;
  color:rgba(51,51,51,1);
  line-height:40px;
  margin-top: 10px;
  /* margin-bottom: 35px; */
}

.nr{
    width: 100%;
    height:calc(100% - 93px);
    overflow: hidden;
    overflow-y: scroll;
}
</style>